﻿using CefSharp;
using CefSharp.WinForms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoRetailsDLL
{
    public static class WebBrowserFunc
    {
        public static void SetInputValue(this ChromiumWebBrowser chromiumWebBrowser,string inputId,string inputValue) 
        {
            string js = $"var input= document.getElementById('{inputId}');setInputValue(input,'{inputValue}')"; 
            chromiumWebBrowser.ExecuteScriptAsync(js);
        }
        public static void GetElementByTextAndClick(this ChromiumWebBrowser chromiumWebBrowser, string tagName, string innerText)
        {
            string js = $"getElementByText('{tagName}', '{innerText}').click();"; 
            chromiumWebBrowser.ExecuteScriptAsync(js);
        }
    }
    
}
